// Agent stockExchange in project StockMarket

/* Initial beliefs and rules */

/* Initial goals */

!start.

/* Plans */

+!start 
<- .print("Stock exchange opens in three seconds.");
		createWorkspace("ora4mas");
		joinWorkspace("ora4mas",_);
		.wait(3000);

		!stockExchangeOpen;

		.broadcast(achieve, start);

		.print("Exchange opened.");
		.wait(10000);

		.broadcast(achieve, finishOperations);
		.wait(3000);
		.print("Exchange closed.");
				  .

-!start [error(E),error_msg(Msg),code(Cmd),code_src(Src),code_line(Line)]
   <- .print("Failed to exec  due to: ",Msg," (",E,"). Command: ",Cmd, " on ",Src,":", Line)
	.			  
+!stockExchangeOpen
 <- 	makeArtifact("VALE5","stocks.StockArt",["VALE5","OFFLINE"]);
		makeArtifact("PETR4","stocks.StockArt",["PETR4","OFFLINE"]);
		makeArtifact("ITUB4","stocks.StockArt",["ITUB4","OFFLINE"]);
		makeArtifact("OGXP3","stocks.StockArt",["OGXP3","OFFLINE"]);
	  	makeArtifact("Money","stocks.MoneyArt",["TESTE"]);
	  	
.